<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>仓库评价</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!--标准mui.css-->
    <link rel="stylesheet" href="__PUBLIC__/css/mui.min.css">
    <!--App自定义的css-->
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/app.css" />
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">仓库评价</h1>
</header>
<div class="mui-content">
    <form class="mui-input-group ">
        <p class="mui-pl-title">仓库评价</p>
        <div class="mui-input-row mui-dz " style="height: auto;">
            <label class="flno pa">星级评价</label>
            <ul class="c xing">
                <li class="xinghover"></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
        <div class="mui-input-row  " style="height: auto;">
            <label class="flno pa">评价内容</label>

            <div class="mui-input-row pj" style="height: auto;">
                <textarea class="ContentWH" rows="5" placeholder="请输入您的评价内容"></textarea>
            </div>
        </div>
    </form>
    <form class="mui-input-group ">
        <p class="mui-pl-title">物流评价</p>
        <div class="mui-input-row mui-dz " style="height: auto;">
            <label class="flno pa">星级评价</label>
            <ul class="w xing">
                <li class="xinghover"></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
        <div class="mui-input-row  " style="height: auto;">
            <label class="flno pa">评价内容</label>
            <div class="mui-input-row pj" style="height: auto;">
                <textarea class="ContentLOG" rows="5" placeholder="请输入您的评价内容"></textarea>
            </div>
        </div>

    </form>
    <div class="mui-input-row mui-radio mui-left" style="text-align: right;">
        <label>匿名评论</label>
        <input name="radio1" type="radio" class="plin">
    </div>
    <button type="button" class="btnpf mui-btn-sz submit">提交</button>
    <input type="hidden" class="orderNumber" value="{:I('OrderSN')}"/>
</div>
<script type="text/javascript" src="__PUBLIC__/js/jquery-3.2.1.min.js"></script>
<script src="__PUBLIC__/js/mui.min.js"></script>
<script src="/public/layer_mobile/layer.js"></script>

</body>

</html>
<script>
    $(function () {
        $('.c li').click(function()
        {
            //获取当前索引
            var index = $(this).index();
            if(index == 0)
            {
                //信息框
                layer.open({
                    content: '至少选择一颗星'
                    ,btn: '我知道了'
                });
                return false
            }
            if(!$(this).hasClass('xinghover'))
            {

                for (var i = index; i >= 0; i--)
                {

                   $('.c li').eq(i).attr('class','xinghover')
                }
            }
            else
            {
                for (var i = index; i <= 4; i++)
                {
                    $('.c li').eq(i).attr('class','')
                }
            }

        })
        $('.w li').click(function()
        {
            //获取当前索引
            var index = $(this).index();
            if(index == 0)
            {
                //信息框
                layer.open({
                    content: '至少选择一颗星'
                    ,btn: '我知道了'
                });
                return false
            }
            if(!$(this).hasClass('xinghover'))
            {

                for (var i = index; i >= 0; i--)
                {

                    $('.w li').eq(i).attr('class','xinghover')
                }
            }
            else
            {
                for (var i = index; i <= 4; i++)
                {
                    $('.w li').eq(i).attr('class','')
                }
            }

        })
    })
    $('.submit').click(function()
    {
        //订单号
        var OrderSN = $('.orderNumber').val()
        //仓库评价评分
        var StarWH =$('.c').children(".xinghover").length ;
        //物流评价评分
        var StarLOG =$('.w').children(".xinghover").length ;
        //仓库评价内容
        var ContentWH = $('.ContentWH').val()
        //仓库物流内容
        var ContentLOG = $('.ContentLOG').val()
        //是否匿名
        var list= $('input:radio[name="radio1"]:checked').val();
        if(list==null){
            var Anonymous = false
        }
        else{
            var Anonymous = true
        }

        $.post("{:U('evaluateOrder')}",{OrderSN:OrderSN,StarWH:StarWH,StarLOG:StarLOG,ContentWH:ContentWH,ContentLOG:ContentLOG,Anonymous:Anonymous},function(rels)
        {
            if(rels.ReturnCode == 0)
            {
                layer.open({
                    content: '评价成功'
                    ,btn: ['我知道了']
                    ,yes: function(index){
                        /*location.reload();
                        layer.close(index);*/
                        location.href = "{:U('index1')}"
                    }
                });
            }
            else
            {
                layer.open({
                    content: rels.ReturnText
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
            }
        })

    })
</script>